import  os
from airtest.core.api import *
from poco import *
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)
connect_device("Android://127.0.0.1:5037/VOYL5DQCUCRCKNFA")
connect_device("Android://127.0.0.1:5037/c4833a97")
dev = device()
set_current("c4833a97")
def file():
    """获取指定文件目录拼接返回需要安装的apk绝对路径"""
    path = "F:\\apk"
    filepath =path+"\\"+os.listdir(path)[0]
    return filepath

def install_app(dev):
    """检查手机是否安装com.je.skgame，如果安装了卸载，如果没有安装则安装"""
    try:
        dev.check_app("com.je.skgametest")
        print("已有的包")
    except:
        install(file())
        print("安装成功")

def Initial_start_up():
    """启动游戏到主界面"""
    poco("CloseBtn").click()
    poco("Login").click()
    poco("InputNameField").set_text("15193613554")
    sleep(3)
    poco("u_img_zhdl_shurudi").set_text("zxcvb123..")
    sleep(3)
    poco("loginBtn").click()

def Turn_off_your_face():
    while True:
        if poco("mButton_CloseBtn").exists():
            poco("mButton_CloseBtn").click()
            return


Turn_off_your_face()

